<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: Scratch</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: Scratch</h1>

    




<section>

<header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>Scratch<span class="signature">(pageContext, opts)</span><span class="type-signature"></span></h2>
        
            <div class="class-description">九宫格翻纸牌组件逻辑部分</div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    
    <h4 class="name" id="Scratch"><span class="type-signature"></span>new Scratch<span class="signature">(pageContext, opts)</span><span class="type-signature"></span></h4>
    

    











    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>pageContext</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">page路由指针</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>opts</code></td>
            

            <td class="type">
            
                
<span class="param-type">Object</span>


            
            </td>

            

            

            <td class="description last">组件所需参数
                <h6>Properties</h6>
                

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>canvasWidth</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">画布宽带</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>canvasHeight</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">画布高度</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>imageResource</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">遮罩层图片</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>r</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last">笔触半径</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>awardTxt</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">底部抽奖文字奖项</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>awardTxtColor</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">底部抽奖文字颜色</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>awardTxtFontSize</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">底部抽奖文字大小</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>maskColor</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last">没有图片遮罩层颜色</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            

            

            <td class="description last">结束回调</td>
        </tr>

    
    </tbody>
</table>

            </td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    
    <dt class="tag-author">Author:</dt>
    <dd class="tag-author">
        <ul>
            <li>pfan</li>
        </ul>
    </dd>
    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="scratch_scratch.js.html">scratch/scratch.js</a>, <a href="scratch_scratch.js.html#line26">line 26</a>
    </li></ul></dd>
    

    

    

    
    <dt class="tag-todo">To Do:</dt>
    <dd class="tag-todo">
        <ul>
            <li>1.drawImage 与 clearRect 清除展示移动端和模拟器不一致</li>
        
            <li>2.小程序无globalCompositeOperation = 'destination-out'属性</li>
        
            <li>3.小程序无getImageData获取像素点对比擦除范围</li>
        
            <li>4.使用 downloadFile 这种方式来先加载图片再绘制</li>
        </ul>
    </dd>
    
</dl>

















    <h5>Example</h5>
    
    <pre class="prettyprint"><code>new Scratch(this,{
   canvasWidth: 197,   //画布宽带
   canvasHeight: 72,  //画布高度
   imageResource: './images/placeholder.png', //遮罩层图片
   r: 4, //笔触半径
   awardTxt: '中大奖', //底部抽奖文字奖项
   awardTxtColor: "#1AAD16", //底部抽奖文字颜色
   awardTxtFontSize: "24px", //底部抽奖文字大小
   maskColor: "red",  //没有图片遮罩层颜色
   callback: () => {
     //清除画布回调
   }
 })</code></pre>



    
    </div>

    

    

    

    

    

    

    

    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Card.html">Card</a></li><li><a href="FruitMachine.html">FruitMachine</a></li><li><a href="Lock.html">Lock</a></li><li><a href="Machine.html">Machine</a></li><li><a href="Scratch.html">Scratch</a></li><li><a href="Shake.html">Shake</a></li><li><a href="Wheel.html">Wheel</a></li></ul><h3>Global</h3><ul><li><a href="global.html#getDis">getDis</a></li><li><a href="global.html#runAsync">runAsync</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Sep 19 2017 21:36:13 GMT+0800 (HKT)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>